package com.mybatisplus.sunpineshop.controller;


import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  猿区生活API
 * </p>
 *
 * @author jobob
 * @since 2020-12-29
 */
@RestController
@RequestMapping("/community")
@CrossOrigin
public class CommunityApiController {
    /**
     * @Author GongXl
     * @Description 获得猿区生活菜单类型列表
     * @Date 2021/2/18 11:31
     * @Param []
     * @return java.util.List<java.util.Map>
     *
     **/
    @RequestMapping("/getCommCateList")
    public List<Map> getCommCateList(){
        List<Map>  list = new ArrayList<Map>();
        Map img1 = new HashMap();
        img1.put("id","1");
        img1.put("menuType","kaoqing");
        img1.put("title","考勤信息");
        list.add(img1);
        Map img2 = new HashMap();
        img2.put("id","2");
        img2.put("menuType","score");
        img2.put("title","成绩信息");
        list.add(img2);
        Map img3 = new HashMap();
        img3.put("id","3");
        img3.put("menuType","life");
        img3.put("title","生活信息");
        list.add(img3);
        for (int i = 4; i < 100; i++) {
            Map temp = new HashMap();
            temp.put("id",i);
            temp.put("menuType","life");
            temp.put("title","生活信息"+i);
            list.add(temp);
        }
        return list;
    }
    /**
     * @Author GongXl
     * @Description 获得菜单tab右侧数据信息
     * @Date 2021/2/19 14:02
     * @Param []
     * @return java.util.List<java.util.Map>
     **/
    @RequestMapping("/getMenuTabContent/{menuType}")
    public List<Map> getMenuTabContent(@PathVariable(name="menuType") String menuType){
        List<Map>  list = new ArrayList<Map>();
        if(null != menuType && menuType.equals("kaoqing")){
            Map img1 = new HashMap();
            img1.put("id","1");
            img1.put("img_url","../../static/icon/member-active.png");//用户头像
            img1.put("username","z3");
            img1.put("name","张三");
            img1.put("sex","男");
            img1.put("status","签到");
            img1.put("content","正常签到");
            list.add(img1);
        }

        return list;
    }
}

